package model;

/**
 * This Enumeration represents all the classes
 * that employees may have taken and will be
 * used for easy comparisons of skill during 
 * schedule construction.
 * 
 * @author Tristan D. Boucher
 * @version Commit #22 9/14/2013
 * 
 */
public enum Classes 
{
  /**
   * Algebra.
   */
  ALGEBRA(95), 

  /**
   * Accelerated Algebra.
   */
  ACCELERATED_ALGEBRA(96140), 

  /**
   * TMath100.
   */
  TMATH(100), 

  /**
   * Math in Society(Math107).
   */
  MATH_IN_SOCIETY(107), 

  /**
   * Statistics(At the moment including StatWay).
   */
  STATS(146),

  /**
   * Math for elementary educators.
   */
  ELEMENTARY_ED(131),

  /**
   * Business Precalculus.
   */
  BUSINESS_PRECALC(147),

  /**
   * Business Calculus.
   */
  BUSINESS_CALCULUS(148),

  /**
   * Precalculus 1.
   */
  PRECALCULUS_1(141),

  /**
   * Precalculus 2 (Trigonometry).
   */
  PRECALCULUS_2(142),

  /**
   * Calculus 1 (Derivatives).
   */
  CALCULUS_1(151),

  /**
   * Calculus 2 (Integrals).
   */
  CALCULUS_2(152),

  /**
   * Calculus 3 (Sequences and Series).
   */
  CALCULUS_3(153),

  /**
   * Calculus 4 (Multi-Variable Calc).
   */
  CALCULUS_4(254),

  /**
   * Linear Algebra (Matrix Algebra).
   */
  LINEAR_ALGEBRA(220),

  /**
   * Differential Equations.
   */
  DIFFERENTIAL_EQUATIONS(238);


  /**
   *  The constant that lists all of the available classes.
   */
  private static final Classes[] MY_CLASSES = {Classes.ACCELERATED_ALGEBRA,
                                               Classes.ALGEBRA,
                                               Classes.TMATH,
                                               Classes.MATH_IN_SOCIETY,
                                               Classes.STATS,
                                               Classes.ELEMENTARY_ED,
                                               Classes.BUSINESS_PRECALC,
                                               Classes.BUSINESS_CALCULUS,
                                               Classes.PRECALCULUS_1,
                                               Classes.PRECALCULUS_2,
                                               Classes.CALCULUS_1,
                                               Classes.CALCULUS_2,
                                               Classes.CALCULUS_3,
                                               Classes.CALCULUS_4,
                                               Classes.LINEAR_ALGEBRA,
                                               Classes.DIFFERENTIAL_EQUATIONS};

  /**
   * The number corresponding to a particular Classes value.
   */
  private int my_index;

  /**
   * True if this class is available to tutor, false if not.
   */
  private boolean my_tutorable;
  
  // Constructor

  /**
   * Constructs a new Class with the specified index. 
   * In this case the numbers are the class indexes such as
   * Math 238 is Differential Equations. So the index for 
   * D.E. is 238.
   * 
   * @param the_index my_index.
   */
  private Classes(final int the_index)
  {
    my_index = the_index;
  }

  // Instance Methods

  /**
   * Setter for if this class is tutorable.
   * 
   * @param the_choice True or False.
   */
  public void setTutorable(final boolean the_choice)
  {
    my_tutorable = the_choice;
  }
  
  /**
   * Returns the Class represented by the given number index.
   * 
   * @param the_index The index of the Class to return. 
   * @return the day represented by the given index. If the
   * index is not recognizable, the default is algebra.
   */
  public static Classes valueOf(final char the_index)
  {
    Classes result = ALGEBRA;

    for (Classes classes : Classes.values())
    {
      if (classes.my_index == the_index)
      {
        result = classes;
        break;
      }
    }

    return result;
  }

  /**
   * Returns all of the Classes types in a Classes array.
   * 
   * @return MY_CLASSES all the Classes variables.
   */
  public static Classes[] getClasses()
  {
    return MY_CLASSES.clone();
  }
  
  /**
   * Returns whether this class is tutorable or not.
   * 
   * @return True if this class is tutorable and false if not.
   */
  public boolean isTutorable()
  {
    return my_tutorable;
  }
  
  /** 
   * Returns a String representation of this Class such as "Calculus_4 (254)".
   * 
   * @return a String representation of this Class.
   */
  public String toString()
  {
    return super.toString() + " (" + my_index + ")";
  }

}
// end of Enumeration Classes